<template>
        <el-scrollbar style="height:100%;">

  <div class="container p-40" v-loading="loading">
    <div>
      <el-form ref="refForm0" :rules="rules" :model="basicForm" disabled label-width="2rem" size="mini">
        <p class="f-20 m-b-20">房租日期:{{new Date().getFullYear()}}年{{Months+1}}月</p>
        <el-row :gutter="40">
          <el-col :span="8">
            <el-form-item label="合同">
              <el-input v-model="basicForm.contractNumber"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="承租人">
              <el-input v-model="basicForm.tenantName"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="地址">
              <el-input v-model="basicForm.address"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="单元编码">
              <el-input v-model="basicForm.roomNomber"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="水费编码">
              <el-input v-model="basicForm.waterCostCode"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="电费编码">
              <el-input v-model="basicForm.electricCostCode"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="气费编码">
              <el-input v-model="basicForm.coalGasCostCode"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="热水费编码">
              <el-input v-model="basicForm.hotWaterCostCode"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label-width="0">
              <label class="el-form-item__label">水电煤缴费提示:水电煤收费日期截止到{{basicForm.expenseMonth |
                timeFormatFilter('yyyy年mm月')}}，以行度为准若有疑问，请电25122920.
              </label>
            </el-form-item>
          </el-col>
        </el-row>
        <p class="f-20 m-b-20">水费</p>
        <el-row :gutter="40">
          <el-col :span="8">
            <el-form-item label="本月行度">
              <el-input v-model="basicForm.monthWaterMobility"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="上月行度">
              <el-input v-model="basicForm.lastMonthWaterMobility"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="用水量">
              <el-input :value="monthWaterConsumption"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="水损量">
              <el-input v-model="basicForm.waterLossConsumption"> </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="`指标内水价${basicForm.lessThanWater}内`">
              <el-input v-model="basicForm.lessUnitPriceOfWater">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="`指标外水价${basicForm.lessThanWater}-${basicForm.greaterThanWater}`">
              <el-input v-model="basicForm.middleUnitPriceOfWater">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="`实际单价${basicForm.greaterThanWater}以上`">
              <el-input v-model="basicForm.greaterUnitPriceOfWater">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="加压管理费">
              <el-input v-model="basicForm.pressureAdministrationCosts">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="水费税金">
              <el-input v-model="basicForm.waterTariff"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="小计">
              <el-input v-model="basicForm.waterRentSubtotal">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <p class="f-20 m-b-20">热水费</p>
        <el-row :gutter="40">
          <el-col :span="8">
            <el-form-item label="本月行度">
              <el-input v-model="basicForm.monthHotWaterMobility"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="上月行度">
              <el-input v-model="basicForm.lastMonthHotWaterMobility"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="用水量">
              <el-input :value="monthHotWaterConsumption"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="热水单价">
              <el-input :value="basicForm.unitPriceHotWater"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
        <el-col :span="24">
            <el-form-item label="小计">
              <el-input v-model="basicForm.hotWaterRentSubtotal">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <p class="f-20 m-b-20">电费</p>
        <el-row :gutter="40">
          <el-col :span="8">
            <el-form-item label="本月行度">
              <el-input v-model="basicForm.monthElectricityMobility"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="上月行度">
              <el-input v-model="basicForm.lastMonthElectricityMobility"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="倍率">
              <el-input v-model="basicForm.electricRate"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="公共用电分摊">
              <el-input v-model="basicForm.publicElectricitySharing"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="实际用量">
              <el-input v-model="basicForm.electricActualConsumption"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="`小于${basicForm.lessElectricityConsumption}时的单价`">
              <el-input v-model="basicForm.lessUnitPriceOfElectricity">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              :label="`${basicForm.lessElectricityConsumption} - ${basicForm.greaterElectricityConsumption}时的单价`">
              <el-input v-model="basicForm.middleUnitPriceOfElectricity">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item :label="`大于${basicForm.greaterElectricityConsumption}时的单价`">
              <el-input v-model="basicForm.greaterUnitPriceOfElectricity">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="小计">
              <el-input v-model="basicForm.electricRentSubtotal">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <p class="f-20 m-b-20">煤气费</p>
        <el-row :gutter="40">
          <el-col :span="8">
            <el-form-item label="本月表数">
              <el-input v-model="basicForm.monthGasMobility"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="上月表数">
              <el-input v-model="basicForm.lastGasMobility"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="用气量">
              <el-input :value="monthGasConsumption"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="第一档单价">
              <el-input v-model="basicForm.oneUnitPrice">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="第二档单价">
              <el-input v-model="basicForm.twoUnitPrice">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="第三档单价">
              <el-input v-model="basicForm.threeUnitPrice">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="气费">
              <el-input v-model="basicForm.gasShortage">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="欠费">
              <el-input v-model="basicForm.gasArrears">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="换表费">
              <el-input v-model="basicForm.gasChangeWatchSpense">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="小计">
              <el-input v-model="basicForm.gasRentSubtotal">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    <p class="f-20 m-b-20">其他费用</p>
      <el-form ref="refForm" :rules="rules" :model="basicForm" label-width="2rem" size="mini">
        <!-- 固定头部 -->
        <el-row :gutter="40">
          <el-col :span="8">
            <!-- <el-form-item v-if="isExamine" label="房租" prop="monthlyRent">
              <div class="el-input el-input--mini el-input--prefix el-input--suffix">
                <input v-model="basicForm.monthlyRent" type="number" autocomplete="off" class="el-input__inner">
                <span class="el-input__prefix">￥</span>
                <span class="el-input__suffix"><span class="el-input__suffix-inner">元</span></span>
              </div>
            </el-form-item> -->
            <el-form-item label="房租" prop="monthlyRent">
              <el-input :disabled="!isExamine" v-model="basicForm.monthlyRent">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="电话费">
              <el-input disabled v-model="basicForm.telephoneRate">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
              <el-form-item v-show = "basicForm.elevatorRate!=null" label="电梯费" prop="elevatorRate">
                <el-input :disabled="!isExamine" type="number" v-model="basicForm.elevatorRate">
                  <template slot="suffix">元</template>
                </el-input>
              </el-form-item>
            </el-col>
          <el-col :span="8">
              <el-form-item v-show = "basicForm.sanitationFee!=null" label="卫生费" prop="sanitationFee">
                <el-input :disabled="!isExamine" type="number" v-model="basicForm.sanitationFee">
                  <template slot="suffix">元</template>
                </el-input>
              </el-form-item>
            </el-col>
          <el-col :span="8">
              <el-form-item v-show = "basicForm.maintenanceFund!=null" label="本体维修基金" prop="maintenanceFund">
                <el-input :disabled="!isExamine" type="number" v-model="basicForm.maintenanceFund">
                  <template slot="suffix">元</template>
                </el-input>
              </el-form-item>
            </el-col>
          <el-col :span="8">
              <el-form-item v-show = "basicForm.gasInsurance!=null" label="电视费/煤保" prop="gasInsurance">
                <el-input :disabled="!isExamine" type="number" v-model="basicForm.gasInsurance">
                  <template slot="suffix">元</template>
                </el-input>
              </el-form-item>
            </el-col>
        </el-row>
      </el-form>
      <el-form ref="refForm3" :rules="rules" :model="basicForm" disabled label-width="2rem" size="mini">
        <el-row :gutter="40">
          <el-col :span="8">
            <el-form-item label="垃圾处理费">
              <el-input v-model="basicForm.trashHandlingFee">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="排水费">
              <el-input v-model="basicForm.drainageFee">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="小计">
              <el-input :value="Number(basicForm.otherSubtotal) + Number(basicForm.monthlyRent)">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="本月应收总额">
              <el-input :value="Number(basicForm.totalAmount)">
                <template slot="prefix">￥</template>
                <template slot="suffix">元</template>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <!-- 不是审核的 进来 是通知单 -->
      <el-row v-if="!isExamine" justify="center" style="margin-top: 0.2rem">
        <el-col :span="4" :offset="10">
          <router-link class="el-button el-button--mini el-button--primary"
            :to="`/cost/notice/${basicForm.fkExpenseManagId}`">
            通知单
          </router-link>
          <el-button type="info" @click="$router.push('/cost/list')">返回</el-button>
        </el-col>
      </el-row>
      <template v-else>
        <el-form disabled label-width="2rem" size="mini">
          <p class="f-20 m-b-20">{{ 0 >= (Months-2) ? 12+(Months-2):(Months-2) }}月份：水/电/煤气管理费</p>
          <el-row :gutter="40">
            <el-col :span="8">
              <el-form-item :label="'水：'+(0 >= (Months-2) ? 12+(Months-2):(Months-2))+'月行度'">
                <el-input :value="basicForm.expenseEntry.threeMonthWaterMobility"> </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="用水量">
                <el-input v-model="basicForm.expenseEntry.threeMonthWaterConsumption"> </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="40">
            <el-col :span="8">
              <el-form-item :label="'热水：'+(0 >= (Months-2) ? 12+(Months-2):(Months-2))+'月行度'">
                <el-input :value="basicForm.expenseEntry.threeMonthHotWaterMobility"> </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="热水用水量">
                <el-input v-model="basicForm.expenseEntry.threeMonthHotWaterConsumption"> </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="40">
            <el-col :span="8">
              <el-form-item :label="'电：'+(0 >= (Months-2) ? 12+(Months-2):(Months-2))+'月行度'">
                <el-input v-model="basicForm.expenseEntry.threeMonthElectricityMobility"> </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="用电量">
                <el-input v-model="basicForm.expenseEntry.threeMonthElectricityConsumption"> </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="40">
            <el-col :span="8">
              <el-form-item :label="'煤：'+(0 >= (Months-2) ? 12+(Months-2):(Months-2))+'月表数'">
                <el-input v-model="basicForm.expenseEntry.threeMonthGasMobility"> </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="用气量">
                <el-input v-model="basicForm.expenseEntry.threeMonthGasConsumption"> </el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <el-form disabled label-width="2rem" size="mini">
          <p class="f-20 m-b-20">{{0 >= (Months-1) ? 12+(Months-1):(Months-1)}}月份：水/电/煤气管理费</p>
          <el-row :gutter="40">
            <el-col :span="8">
              <el-form-item :label="'水：'+(0 >= (Months-1) ? 12+(Months-1):(Months-1))+'月行度'">
                <el-input v-model="basicForm.expenseEntry.twoMonthWaterMobility"> </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="用水量">
                <el-input v-model="basicForm.expenseEntry.twoMonthWaterConsumption"> </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="40">
            <el-col :span="8">
              <el-form-item :label="'热水：'+(0 >= (Months-1) ? 12+(Months-1):(Months-1))+'月行度'">
                <el-input v-model="basicForm.expenseEntry.twoMonthHotWaterMobility"> </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="热水用水量">
                <el-input v-model="basicForm.expenseEntry.twoMonthHotWaterConsumption"> </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="40">
            <el-col :span="8">
              <el-form-item :label="'电：'+(0 >= (Months-1) ? 12+(Months-1):(Months-1))+'月行度'">
                <el-input v-model="basicForm.expenseEntry.twoMonthElectricityMobility"> </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="用电量">
                <el-input v-model="basicForm.expenseEntry.twoMonthElectricityConsumption"> </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="40">
            <el-col :span="8">
              <el-form-item :label="'煤：'+(0 >= (Months-1) ? 12+(Months-1):(Months-1))+'月表数'">
                <el-input v-model="basicForm.expenseEntry.twoMonthGasMobility"> </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="用气量">
                <el-input v-model="basicForm.expenseEntry.twoMonthGasConsumption"> </el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <el-form ref="refForm2" :rules="rules" :model="basicForm" label-width="2rem" size="mini">
          <p class="f-20 m-b-20">水/电/煤气管理费</p>
          <el-row :gutter="40">
            <!--1013 取消自渎-->
            <el-col :span="8">
              <el-form-item :label="'水：'+(0 == Months ? 12+Months:Months)+'月行度'">
                <el-input type="number" v-model="basicForm.lastMonthWaterMobility"> </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="本月行度" :prop="(isExamine&&basicForm.waterCostCode)?'monthWaterMobility':null">
                <el-input type="number" :disabled="isExamine&&!(basicForm.waterCostCode)"
                  v-model="basicForm.monthWaterMobility">
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="用水量">
                <el-input disabled :value="monthWaterConsumption"> </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="40">
            <el-col :span="8">
              <el-form-item :label="'热水：'+(0 == Months ? 12+Months:Months)+'月行度'">
                <el-input type="number" v-model="basicForm.lastMonthHotWaterMobility"> </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="热水本月行度" :prop="(isExamine&&basicForm.hotWaterCostCode)?'monthHotWaterMobility':null">
                <el-input type="number" :disabled="isExamine&&!(basicForm.hotWaterCostCode)"
                  v-model="basicForm.monthHotWaterMobility">
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="热水用水量">
                <el-input disabled :value="monthHotWaterConsumption"> </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="40">
              <!--1013 取消自渎-->
            <el-col :span="8">
              <el-form-item :label="'电：'+(0 == Months ? 12+Months:Months)+'月行度'">
                <el-input type="number" v-model="basicForm.lastMonthElectricityMobility"> </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item :prop="(isExamine&&basicForm.electricCostCode)?'monthElectricityMobility':null"
                label="本月行度">
                <el-input type="number" :disabled="isExamine&&!(basicForm.electricCostCode)"
                  v-model="basicForm.monthElectricityMobility"> </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="用电量">
                <el-input disabled :value="monthElectricityConsumption"> </el-input>
              </el-form-item>
            </el-col>
          </el-row>
            <!--1013 取消自渎-->
          <el-row :gutter="40">
            <el-col :span="8">
              <el-form-item :label="'煤：'+(0 == Months ? 12+Months:Months)+'月表数'">
                <el-input type="number" v-model="basicForm.lastGasMobility"> </el-input>
              </el-form-item>
            </el-col>

            <el-col :span="8">
              <el-form-item :prop="(isExamine&&basicForm.coalGasCostCode)?'monthGasMobility':null" label="本月表数">
                <el-input type="number" :disabled="isExamine&&!(basicForm.coalGasCostCode)"
                  v-model="basicForm.monthGasMobility"> </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="用气量">
                <el-input disabled :value="monthGasConsumption"> </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="40">
            <!-- huangjj 1013日改动 -->
            <el-col :span="8">
                <el-form-item label="气费" prop="gasShortage">
                    <el-input type="number" v-model="basicForm.gasShortage">
                        <template slot="suffix">元</template>
                    </el-input>
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="基本电价" prop="basicElectricityPrice">
                    <el-input type="number" v-model="basicForm.basicElectricityPrice">
                        <template slot="suffix">元</template>
                    </el-input>
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="基本水费" prop="basicWaterPrice">
                    <el-input type="number" v-model="basicForm.basicWaterPrice">
                        <template slot="suffix">元</template>
                    </el-input>
                </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="40">
            <el-col :span="8">
                <el-form-item label="综合管理费" prop="comprehensiveManagementRate">
                    <el-input type="number" v-model="basicForm.comprehensiveManagementRate">
                        <template slot="suffix">元</template>
                    </el-input>
                </el-form-item>
            </el-col>
            <el-col :span="8">
                <el-form-item label="其他" prop="otherPrice">
                    <el-input type="number" v-model="basicForm.otherPrice">
                        <template slot="suffix">元</template>
                    </el-input>
                </el-form-item>
            </el-col>
            <!-- 1013end -->
            <el-col :span="8">
              <el-form-item label="煤气欠费">
                <el-input type="number" :disabled="isExamine&&!(basicForm.coalGasCostCode)" v-model="basicForm.gasArrears">
                  <template slot="suffix">元</template>
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="40">
          <el-col :span="8">
              <el-form-item label="换表费">
                <el-input type="number" :disabled="isExamine&&!(basicForm.coalGasCostCode)" v-model="basicForm.gasChangeWatchSpense">
                  <template slot="suffix">元</template>
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="6" :offset="9" style="margin-top: 40px">
              <el-button type="primary" @click="submit">审核通过</el-button>
              <el-button style="margin-left: 40px;" @click="colse">取消</el-button>
            </el-col>
          </el-row>
        </el-form>
      </template>
    </div>
    <p class="f-18" v-if="bHasWaterDeviceChange">上月该房间有换<span class="color-red">水表</span>,具体用量以实际计算为准，
        <el-link class="primary" @click="$router.push('/room/edit?id='+basicForm.fkRoomId)">点击查看换表记录</el-link>
    </p>
    <p class="f-18" v-if="bHasHotWaterDeviceChange">上月该房间有换<span class="color-red">热水表</span>,具体用量以实际计算为准，
        <el-link class="primary" @click="$router.push('/room/edit?id='+basicForm.fkRoomId)">点击查看换表记录</el-link>
    </p>
    <p class="f-18" v-if="bHasElectricDeviceChange">上月该房间有换<span class="color-red">电表</span>,具体用量以实际计算为准，
        <el-link class="primary" @click="$router.push('/room/edit?id='+basicForm.fkRoomId)">点击查看换表记录</el-link>
    </p>
    <p class="f-18" v-if="bHasGasDeviceChange">上月该房间有换<span class="color-red">气表</span>,具体用量以实际计算为准，
        <el-link class="primary" @click="$router.push('/room/edit?id='+basicForm.fkRoomId)">点击查看换表记录</el-link>
    </p>
  </div>
        </el-scrollbar>
</template>

<script>
  import { getNoticeByContractId, getAuditEcho, meterReadingReview } from "@/api/operations/cost/cost";
  import { getDeviceChangesByRoomId_CurrentMonth } from "@/api/house/room/room.js";
  export default {
    computed: {
      Months() {
        return new Date(this.basicForm.expenseMonth).getMonth(); //取消+1
      },
      monthWaterConsumption() {
        if (!this.isExamine) return this.basicForm.waterConsumption;
        if (this.basicForm.monthWaterMobility!=null) {
          if (!this.basicForm.lastMonthWaterMobility) {
            this.basicForm.lastMonthWaterMobility = 0;
          }
          return (this.basicForm.monthWaterMobility * 10000 -
            this.basicForm.lastMonthWaterMobility * 10000) / 10000;
        }
      },
      monthHotWaterConsumption() {
        if (!this.isExamine) return this.basicForm.hotwaterConsumption;
        if (this.basicForm.monthHotWaterMobility!=null) {
          if (!this.basicForm.lastMonthHotWaterMobility) {
            this.basicForm.lastMonthHotWaterMobility = 0;
          }
          return (this.basicForm.monthHotWaterMobility * 10000 -
            this.basicForm.lastMonthHotWaterMobility * 10000) / 10000;
        }
      },
      monthElectricityConsumption() {
        if (!this.isExamine) return this.basicForm.monthElectricityConsumption;
        if (this.basicForm.monthElectricityMobility!=null) {
          if (!this.basicForm.lastMonthElectricityMobility) {
            this.basicForm.lastMonthElectricityMobility = 0;
          }
          return (this.basicForm.monthElectricityMobility * 10000 -
            this.basicForm.lastMonthElectricityMobility * 10000) / 10000;
        }
      },
      monthGasConsumption() {
        if (!this.isExamine) return this.basicForm.monthGasConsumption;
        if (this.basicForm.monthGasMobility!=null) {
          if (!this.basicForm.lastGasMobility) {
            this.basicForm.lastGasMobility = 0;
          }
          return (this.basicForm.monthGasMobility * 10000 -
            this.basicForm.lastGasMobility * 10000) / 10000;
        }
      }
    },
    data() {
      return {
        loading: false,
        isExamine: false,
        //全部FROM
        basicForm: {},
        rules: {
          elevatorRate:[
            { validator: this.$rules.PriceNumberCanBeNull },
          ],
          sanitationFee:[
            { validator: this.$rules.PriceNumberCanBeNull },
          ],
          maintenanceFund:[
            { validator: this.$rules.PriceNumberCanBeNull },
          ],
          gasInsurance:[
            { validator: this.$rules.PriceNumberCanBeNull },
          ],
          monthlyRent: [
            {
              required: true,
              message: "此项必填，请输入"
            },
            { validator: this.$rules.PriceNumber }],
          monthWaterMobility: [{
            required: true,
            message: "此项必填，请输入"
          },
          { validator: this.$rules.PriceNumber }],
          monthHotWaterMobility: [{
            required: true,
            message: "此项必填，请输入"
          },
          { validator: this.$rules.PriceNumber }],
          monthElectricityMobility: [{
            required: true,
            message: "此项必填，请输入"
          },
          { validator: this.$rules.PriceNumber }],
          monthGasMobility: [{
            required: true,
            message: "此项必填，请输入"
          },
          { validator: this.$rules.PriceNumber }],
          // 1013
            basicElectricityPrice: [{
                required: true,
                message: "请输入基本电价",
                trigger: "blur"
            },
            {validator: this.$rules.PriceNumberAndNegative,trigger:"blur" }],
            basicWaterPrice :[{
              required: true,
                message: "请输入基本水费",
                trigger: "blur"
            },
            {validator: this.$rules.PriceNumberAndNegative,trigger:"blur" }],
            otherPrice: [{
                required: true,
                message: "请输入其他",
                trigger: "blur"
            },
            {validator: this.$rules.PriceNumberAndNegative,trigger:"blur" }],
            gasShortage: [{
                required: true,
                message: "请输入气费",
                trigger: "blur"
            }],
            comprehensiveManagementRate: [{
                required: true,
                message: "请输入综合管理费",
                trigger: "blur"
            }],
            lastMonthWaterMobility:[{validator: this.$rules.PriceNumberOrNull,trigger:"blur" }],
            lastMonthHotWaterMobility:[{validator: this.$rules.PriceNumberOrNull,trigger:"blur" }],
            lastMonthElectricityMobility:[{validator: this.$rules.PriceNumberOrNull,trigger:"blur" }],
            lastGasMobility:[{validator: this.$rules.PriceNumberOrNull,trigger:"blur" }],
            // 1013
          },
          bHasWaterDeviceChange:false,
          bHasHotWaterDeviceChange:false,
          bHasElectricDeviceChange:false,
          bHasGasDeviceChange:false
      };
    },

    methods: {
      submit() {
            this.$refs["refForm"].validate((valid) => {
                if (valid) {
                    this.$refs["refForm2"].validate((valid) => {
                        if (valid) {
                            let obj = {};
                            obj.monthElectricityConsumption = this.monthElectricityConsumption;
                            obj.monthElectricityMobility = this.basicForm.monthElectricityMobility;
                            obj.monthGasConsumption = this.monthGasConsumption;
                            obj.monthGasMobility = this.basicForm.monthGasMobility;
                            obj.monthWaterConsumption = this.monthWaterConsumption;
                            obj.monthHotWaterConsumption = this.monthHotWaterConsumption;
                            obj.monthWaterMobility = this.basicForm.monthWaterMobility;
                            obj.monthHotWaterMobility = this.basicForm.monthHotWaterMobility;
                            obj.pkExpenseEntryId = this.basicForm.expenseEntry.pkExpenseEntryId;
                            obj.gasArrears = this.basicForm.gasArrears;
                            obj.gasChangeWatchSpense = this.basicForm.gasChangeWatchSpense;
                            obj.fkExpenseManagId = this.basicForm.fkExpenseManagId;
                            obj.fkRoomId = this.basicForm.fkRoomId;
                            obj.monthlyRent = this.basicForm.monthlyRent;
                            // 1209
                            obj.elevatorFee = this.basicForm.elevatorRate;
                            obj.sanitationFee = this.basicForm.sanitationFee;
                            obj.gasInsurance = this.basicForm.gasInsurance;
                            obj.maintenanceFund = this.basicForm.maintenanceFund;
                            obj.totalAmount = this.basicForm.totalAmount;

                            // 1013
                            obj.basicElectricityPrice  = this.basicForm.basicElectricityPrice;
                            obj.basicWaterPrice = this.basicForm.basicWaterPrice;
                            obj.otherPrice = this.basicForm.otherPrice;
                            obj.gasShortage = this.basicForm.gasShortage;
                            obj.comprehensiveManagementRate = this.basicForm.comprehensiveManagementRate;

                            obj.lastGasMobility = this.basicForm.lastGasMobility;
                            obj.lastMonthElectricityMobility = this.basicForm.lastMonthElectricityMobility;
                            obj.lastMonthWaterMobility = this.basicForm.lastMonthWaterMobility;
                            obj.lastMonthHotWaterMobility = this.basicForm.lastMonthHotWaterMobility;
                            // 1013 end

                            if (!obj.gasChangeWatchSpense) {
                            obj.gasChangeWatchSpense = 0;
                            }
                            if (!obj.gasArrears) {
                            obj.gasArrears = 0;
                            }
                            meterReadingReview(obj).then(res => {
                            if (res.code === 10000) {
                                this.$message.success(res.msg);
                                this.colse();
                            }
                            });
                        }
                    });
                }
            });
      },
      colse() {
        window.history.go(-1);
      }
    },
    mounted() {
      //true 是审核 其他是审核详情
      this.isExamine = (this.$route.params.isExamine == 'true');
      if (this.$route.params.id) {
        if (this.isExamine) {
            getAuditEcho(this.$route.params.id).then(res => {
                this.basicForm = res.data;
                this.basicForm.otherSubtotal = Number(this.basicForm.otherSubtotal) - Number(this.basicForm.monthlyRent);
                getDeviceChangesByRoomId_CurrentMonth(this.basicForm.fkRoomId,"true").then( res => {
                        if (res.code == 10000) {
                            let deviceChanges = res.data;
                            let iLen =deviceChanges.length;
                            if (iLen > 0) {
                                for (let i = 0;i < iLen;i++) {
                                    //如果之前没有换水表记录，就到当前记录看是否有 换水表记录；否则略过这条记录的水表检测
                                    if (!this.bHasWaterDeviceChange)
                                        this.bHasWaterDeviceChange = deviceChanges[i].newWaterReading != null ? true:false;

                                    if (!this.bHasHotWaterDeviceChange)
                                        this.bHasHotWaterDeviceChange = deviceChanges[i].newHotWaterReading != null ? true:false;

                                    if (!this.bHasElectricDeviceChange)
                                        this.bHasElectricDeviceChange = deviceChanges[i].newElectricReading != null ? true:false;

                                    if (!this.bHasGasDeviceChange)
                                        this.bHasGasDeviceChange = deviceChanges[i].newGasReading != null ? true:false;
                                }
                            }
                        }
                    });
            });
        } else {
            getNoticeByContractId(this.$route.params.id).then((res) => {
                this.basicForm = res.data;
                this.basicForm.otherSubtotal = Number(this.basicForm.otherSubtotal) - Number(this.basicForm.monthlyRent);
                getDeviceChangesByRoomId_CurrentMonth(this.basicForm.fkRoomId,"true").then( res => {
                        if (res.code == 10000) {
                            let deviceChanges = res.data;
                            let iLen =deviceChanges.length;
                            if (iLen > 0) {
                                for (let i = 0;i < iLen;i++) {
                                    //如果之前没有换水表记录，就到当前记录看是否有 换水表记录；否则略过这条记录的水表检测
                                    if (!this.bHasWaterDeviceChange)
                                        this.bHasWaterDeviceChange = deviceChanges[i].newWaterReading != null ? true:false;

                                    if (!this.bHasHotWaterDeviceChange)
                                        this.bHasHotWaterDeviceChange = deviceChanges[i].newHotWaterReading != null ? true:false;

                                    if (!this.bHasElectricDeviceChange)
                                        this.bHasElectricDeviceChange = deviceChanges[i].newElectricReading != null ? true:false;

                                    if (!this.bHasGasDeviceChange)
                                        this.bHasGasDeviceChange = deviceChanges[i].newGasReading != null ? true:false;
                                }
                            }
                        }
                    });
            });
        }
      }
    },
  };
</script>
